package org.jsola.hr.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jsola.hr.entity.SocDispatchEmpItemDO;
import org.jsola.orm.mapper.IJsolaMapper;
import org.springframework.stereotype.Repository;

import java.util.List;


/**
 * 社保派单员工表_增员子项
 *
 * @author zhr
 */
@Repository("hrSocDispatchEmpItemDAO")
public interface ISocDispatchEmpItemDAO extends IJsolaMapper<SocDispatchEmpItemDO> {

    /**
     * 获取某次导入的参保项名称
     *
     * @param socDispatchId 参保记录id
     * @param siteId        站点id
     * @return 所有的参保项名称
     */
    @Select(" select distinct item_name                 " +
            "   from hr_soc_dispatch_emp_item           " +
            "  where soc_dispatch_id = #{socDispatchId} " +
            "    and site_id = #{siteId}                " +
            "    and is_valid = 1                       " +
            "  ORDER BY                                 " +
            "	        item_type,                      " +
            "	        item_name  like '养老%' desc,   " +
            "	        item_name  like '医疗%' desc,   " +
            "	        item_name  like '工伤%' desc,   " +
            "	        item_name  like '生育%' desc,   " +
            "	        item_name  like '失业%' desc,   " +
            "	        item_name,                      " +
            "	        sort                            " +
            "")
    List<String> listItemNameBySocDispatch(@Param(value = "socDispatchId") String socDispatchId, @Param(value = "siteId") String siteId);
}

